/*-----------------------------------------------------------------------------
#
#	Apple Macintosh Developer Technical Support
#
#	AppleTalk GetZoneList Sample Application
#
#	GetZoneList
#
#	GetZoneList.r	-	Rez Source
#
#	Copyright © 1988 Apple Computer, Inc.
#	All rights reserved.
#
#	Versions:	1.0					11/88
#
#	Components:	GetZoneList.p		November 1, 1988
#				GetZoneList.r		November 1, 1988
#				GetZoneList.make	November 1, 1988
#
#	GetZoneList is a sample application that uses
#	AppleTalk ATP and ZIP to obtain a list of zones
#	on an AppleTalk internet.
#
#	GetZoneList also demonstrates using a signal, or
#	failure-catching mechanism to recover from error
#	situations.
#
#	GetZoneList is based on MACDTS Sample.p. For more
#	description and explanantion of the non-example
#	specific areas of this application, please refer to
#	either Sample.p or TESample.p.
#
-----------------------------------------------------------------------------*/

#include "Types.r"


#define kMinSize	22		/* application's minimum size (in K) */
#define kPrefSize	26		/* application's preferred size (in K) */

#define	rAboutAlert	128		/* about alert */
#define rZoneDialog	129		/* zone list dialog */
#define rUserAlert	130		/* error alert */

#define	sErrStrings	128		/* error strings STR# ID */

#define	rMenuBar	128		/* application's menu bar */

#define	mApple		128		/* Apple menu */

#define	mFile		129		/* File menu */

#define	mEdit		130		/* Edit menu */

/* these #defines are used to set enable/disable flags of a menu */

#define AllItems	0b1111111111111111111111111111111	/* 31 flags */
#define NoItems		0b0000000000000000000000000000000
#define MenuItem1	0b0000000000000000000000000000001
#define MenuItem2	0b0000000000000000000000000000010
#define MenuItem3	0b0000000000000000000000000000100
#define MenuItem4	0b0000000000000000000000000001000
#define MenuItem5	0b0000000000000000000000000010000
#define MenuItem6	0b0000000000000000000000000100000
#define MenuItem7	0b0000000000000000000000001000000
#define MenuItem8	0b0000000000000000000000010000000
#define MenuItem9	0b0000000000000000000000100000000
#define MenuItem10	0b0000000000000000000001000000000
#define MenuItem11	0b0000000000000000000010000000000
#define MenuItem12	0b0000000000000000000100000000000


/* we use an MBAR resource to conveniently load all the menus */

resource 'MBAR' (rMenuBar, preload) {
	{ mApple, mFile, mEdit };	/* three menus */	
};


resource 'MENU' (mApple, preload) {
	mApple, textMenuProc,
	AllItems & ~MenuItem2,		/* Disable dashed line, enable About and DAs */
	enabled, apple,
	{
		"About GetZoneListÉ",
			noicon, nokey, nomark, plain;
		"-",
			noicon, nokey, nomark, plain
	}
};

resource 'MENU' (mFile, preload) {
	mFile, textMenuProc,
	MenuItem1 | MenuItem12,		/* enable Quit and New only, program enables others */
	enabled, "File",
	{
		"New",
			noicon, "N", nomark, plain;
		"Open",
			noicon, "O", nomark, plain;
		"-",
			noicon, nokey, nomark, plain;
		"Close",
			noicon, "W", nomark, plain;
		"Save",
			noicon, "S", nomark, plain;
		"Save AsÉ",
			noicon, nokey, nomark, plain;
		"Revert",
			noicon, nokey, nomark, plain;
		"-",
			noicon, nokey, nomark, plain;
		"Page SetupÉ",
			noicon, nokey, nomark, plain;
		"PrintÉ",
			noicon, nokey, nomark, plain;
		"-",
			noicon, nokey, nomark, plain;
		"Quit",
			noicon, "Q", nomark, plain
	}
};

resource 'MENU' (mEdit, preload) {
	mEdit, textMenuProc,
	NoItems,					/* disable everything, program does the enabling */
	enabled, "Edit",
	 {
		"Undo",
			noicon, "Z", nomark, plain;
		"-",
			noicon, nokey, nomark, plain;
		"Cut",
			noicon, "X", nomark, plain;
		"Copy",
			noicon, "C", nomark, plain;
		"Paste",
			noicon, "V", nomark, plain;
		"Clear",
			noicon, nokey, nomark, plain
	}
};

/* this ALRT and DITL are used as an About screen */

resource 'ALRT' (rAboutAlert) {
	{40, 20, 160, 292}, rAboutAlert, {
		OK, visible, silent;
		OK, visible, silent;
		OK, visible, silent;
		OK, visible, silent
	};
};

resource 'DITL' (rAboutAlert) {
	 {
		{88, 180, 108, 260},
		Button {
			enabled,	"OK"
		};
		{8, 8, 24, 214},
		StaticText {
			disabled,	"GetZoneList"
		};
		{32, 8, 48, 237},
		StaticText {
			disabled,	"Copyright © 1988 Apple Computer"
		};
		{56, 8, 72, 136},
		StaticText {
			disabled,	"Brought to you by:"
		};
		{80, 24, 112, 167},
		StaticText {
			disabled,	"Macintosh Developer " $"CA" "Technical Support"
		}
	}
};


/* this DLOG and DITL are used for the Zone List dialog */

resource 'DLOG' (rZoneDialog) {
	{100, 200, 300, 400},
	dBoxProc,
	invisible,
	noGoAway,
	0x0,
	rZoneDialog,
	""
};

resource 'DITL' (rZoneDialog) {
	{
		{160, 120, 180, 180},
		Button {
			enabled,
			"OK"
		},
		{20, 20, 140, 180},
		UserItem {
			enabled
		},
		{160, 120, 180, 180},
		UserItem {
			disabled
		}
	}
};


/* this ALRT and DITL are used as an error screen */

resource 'ALRT' (rUserAlert, purgeable) {
	{40, 20, 180, 260},
	rUserAlert,
	{ /* array: 4 elements */
		/* [1] */
		OK, visible, silent,
		/* [2] */
		OK, visible, silent,
		/* [3] */
		OK, visible, silent,
		/* [4] */
		OK, visible, silent
	}
};


resource 'DITL' (rUserAlert, purgeable) {
	{ /* array DITLarray: 4 elements */
		/* [1] */
		{110, 150, 130, 230},
		Button {
			enabled,
			"OK"
		},
		/* [2] */
		{10, 60, 60, 230},
		StaticText {
			disabled,
			"Error. ^0."
		},
		/* [3] */
		{70, 60, 90, 230},
		StaticText {
			disabled,
			"^1"
		},
		/* [4] */
		{8, 8, 40, 40},
		Icon {
			disabled,
			2
		}
	}
};


resource 'STR#' (sErrStrings, purgeable) {
	{
	"An error occurred. The error number is: ";
	"You must run on 512Ke or later";
	"Application Memory Size is too small";
	"Not enough memory to run GetZoneList";
	"An AppleTalk-related error occurred";
	"There are no zones"
	}
};


/* we put the latest SIZE template here so we can rez with MPW 2.0 */

type 'SIZE' {
		boolean		dontSaveScreen,
					saveScreen;
		boolean 	ignoreSuspendResumeEvents,
					acceptSuspendResumeEvents;
		boolean		enableOptionSwitch,
					disableOptionSwitch;
		boolean		cannotBackground,
					canBackground;
		boolean		notMultiFinderAware,
					multiFinderAware;
		boolean		notOnlyBackground,
					onlyBackground;
		boolean		dontGetFrontClicks,
					getFrontClicks;
		unsigned bitstring[9] = 0;
		unsigned longint;	/* preferred memory size in bytes */
		unsigned longint;	/* minimum memory size in bytes */
};	/* ignore the warning caused by re-defining SIZE */


/* here is the quintessential MultiFinder friendliness device, the SIZE resource */

resource 'SIZE' (-1) {
	dontSaveScreen,
	acceptSuspendResumeEvents,
	enableOptionSwitch,
	canBackground,		/* we can background; we don't currently, but our sleep value */
						/* guarantees we don't hog the Mac while we are in the background */
	multiFinderAware,	/* this says we do our own activate/deactivate; don't fake us out */
	notOnlyBackground,	/* this is definitely note a background-only application! */
	dontGetFrontClicks,	/* change this is if you want "do first click" behavior like the Finder */
	kPrefSize * 1024,
	kMinSize * 1024
};
